package com.lst.api.vo;

import com.lst.api.entity.TaxInfo;
import com.lst.api.exception.RequestParamErrorException;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * 企业申请税务信息
 *
 * @author Frank
 * @date 2019-12-30 10:31:38
 * @version: V1.0
 */
@Data
@NoArgsConstructor
public class TaxInfoVo implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(name = "year", value = "年份", required = true, dataType = "String")
    private String year;

    @ApiModelProperty(name = "taxLevel", value = "税务等级", required = true, dataType = "String")
    private String taxLevel;

    public TaxInfoVo(TaxInfo taxInfo) {
        if (taxInfo == null) {
            return;
        }
        this.year = taxInfo.getYear();
        this.taxLevel = taxInfo.getTaxLevel();
    }

    public void check() {
        boolean check = StringUtils.isNotBlank(this.year)
                && StringUtils.isNotBlank(this.taxLevel);
        if (!check) {
            throw new RequestParamErrorException("TaxInfoVo请求参数不合法！");
        }
    }
}